home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
miggy
/
miggy.doc
< prev
next >
Wrap
Text File
|
1999-11-29
|
15KB
|
394 lines
--------------------------------------------------------------------------
Initial release by Olly 18-Nov-99
--------------------------------------------------------------------------
Miggy - Yet another attempt at artificial intelligence :)
PROGRAM HISTORY: (a must read!)
----------------
Late '89 (<- True!)
Purchase of new A500, began with (Yuk!) AmigaBasic, started working with
specific responses to user input. After 15 mins coding, my brain
subconciously calculated a large number beginning with 5 and many decimal
places concerning the number of specific responses required before project
completion. Needless to say, scrapped!
Early '90
Changed coding language to ASM.
*Large time-warp here - Left Army in mid '95*
11-05-99
After MANY projects and a BBS filebase (FB11 - Max's), I came across a
project from Aminet called HAL9001 V1.42 by Simon Champion, written late
'98 in Amos Pro. His idea was a step forward, to output responses using a
certain formula based on Nouns and Verbs. Amos being a somewhat buggy and
unstable language, I couldn't get it to reply a single sentence without
crashing with a dead-end (80000006) alert every time, but it started me
thinking.
12-05-99
24 hour thinktank. Experimented with a few routines. Input parser routine
complete. Working out file formats (preferably editable ASCII), basic
program structure complete. Can't sleep.
13-05-99
Main problem with this kind of program is that 90% completion is required
before first test can be established. Ran a few tests - deemed fairly
successful. Did some more tweaking, doesn't crash randomly anymore :)
14-05-99
Complete! Miggy uses particular files based on mood and emotion, such as
good and bad subject, happy and sad etc. Words in dictionary require their
own mood/emotion and meaning. Responses gleaned from these facts. Miggy
has the ability to learn. Responses randomly fetched once mood/emotion is
determined. Code pretty patched and messy though :(
Program upkeep difficult, as later stages of testing showed. Program
ability to learn hampered by requirement of many more moods/emotions than
originally catered for. Therefore, brain recalculates number - result much
smaller this time, albeit still too large for practicality. Especially
when in "Learn" mode, too cumbersome to teach and too many variables based
on what mood/meaning I myself deem a particular word to have and what
someone else does. Hmm.. Scrapped! (again)
15-05-99
Major rethink. Need to cut down on number of files used. Also want to
cater for different languages, as I would like to see this program spread
worldwide with users creating either their own or adding to existing
files in their own language. "Learn" mode must be simplistic, as users
might tire of this and leave it alone. Decided to keep input parsing
routine as it worked fine. :þ What kind of algorithm is required to
calculate an appropriate response? Is this the kind of thing that lonely
people do? Is this concept possible at all? [sigh].. Still can't sleep.
16-05-99
Some more experimentation with ideas and routines. Major routines
reworked completely to cater for file formats. Attempting to maintain
maximum speed for when datafiles grow large. How many words in the English
(or then again, any other) language? 65,535 should be enough, as most
English dictionaries only contain about 30,000 or so. Response parser
EXTREMELY fast but has spurious problems I'm unable to pin down. Memory
requirements reduced massively (to 8848 bytes!) by slowing down response
parser slightly. Some more teeny bugs squished.
17-05-99
Prettied up the output, tested some more. Found another bug that was
subsequently squished. 2 major sub-routines placed in-line to help
fatter processors with instruction caches. After more testing, determined
that random response-fetch routine too hit and miss. Replaced with smaller
and more intelligent method.
Complete! The fully reworked Miggy now works fine without any crashing or
wierd binary output. Fully customizable for most languages with minimal
memory requirements. Even with little data in files responses becoming
intelligent. Should work on Kick 1.3 machines as well (does 1.3 understand
the assign "PROGDIR:"? If not - assign it :) Executable size under 2K.
---------------------------------------------------------------------------
So now you know what this project is all about. If you didn't read the
program history, I strongly suggest you do so. I'll stop typing in the
meantime..
All righty then! Maybe the next question is WHY? I dunno really, because
it was there - or maybe it wasn't. I've seen a few of these programs
floating around for some time, but none of them held my attention for very
long, as the responses calculated (assumed?) didn't appear too intelligent
but rather more convoluted, and Deep Blue (the chess champion) is WAY outta
my price range and also lacks personality.
In any case - the deed has been done. At this time I consider Miggy to be
capable of simple hello, goodbye, yes & no type conversations with little
available data. After some more time has been spent teaching it, Miggy's
able to create better matches due to greater availablity of data and wider
choice. I would like to see its capabilities with a large (1+ meg)
response file!
STARTING MIGGY:
---------------
Miggy is a CLI only program - there's no icon. If you add an icon and
start it then it's sure to crash as I didn't build it to be started that
way. Create a script that calls Miggy then start the script with an icon
that calls C:IconX if you must have an icon for it.
From the CLI, type DH1:Miggy/Miggy, or wherever it lives.
It will load its MiggyText file, Dictionary and Response file. You'll then
be faced with a "->" prompt. From here just type "Hello" for example, and
you'll be on your way.
The input parser knows only 2 commands:
"#l" - Enter "Learn" mode (See: TEACHING)
"#q" - Quit
The maximum input length Miggy reads at any prompt is 75 characters.
Total memory requirements are:
8848 + Dictionary file length + Response file length.
The MiggyText file looks like this:
---------------------------------------------------------------------------
Miggy V1.00 © Olly Koenders Australia 17-05-99.
Loading reference files..
Dictionary words:
Response records:
Learn mode activated - Type word/sentence to learn..
Type 3 generic responses: 1st-Vague, 2nd-Semi coherent, 3rd-Understanding
Learn mode deactivated.
Match:
abcdefghijklmnopqrstuvwxyz';:>8^-()þ]}
ABCDEFGHIJKLMNOPQRSTUVWXYZ';:>8^-()þ]}
---------------------------------------------------------------------------
These lines can be edited to your liking/language. I wonder if any lamers
will put their own name at the top..? There MUST be 10 lines and each line
MUST end with a 0x0a/#10/linefeed or expect problems.
THE INPUT PARSER:
-----------------
..is the "->" prompt. From here anything you type will be split into
single words, and these characters:
abcdefghijklmnopqrstuvwxyz';:>8^-()þ]}
..if found in the input will be changed into these:
ABCDEFGHIJKLMNOPQRSTUVWXYZ';:>8^-()þ]}
Any others will be masked so that only the characters from the second line
will end up in the dictionary. Typing "Hello,there!" will become
"HELLO THERE " and entering "You're not" will become "YOU'RE NOT". The
format for these 2 lines must be:
lowercasecharactersinyourlanguage+anyothersyouwant
UPPERCASECHARACTERSINYOURLANGUAGE+anyothersyouwant
All lowercase characters in the first line must correspond to the uppercase
characters in the second. The apostrophe "'" is there for words like
"Can't" etc., and the others are for smileys. :)
Uppercasing the input words is essential as the computer sees "This" and
"THIS" as 2 completely different things.
I recommend you don't add "!" or "?" as they are normally posted at the end
of a word, and words like "YES" and "YES!" will end up in the Dictionary -
they are the same thing.
Miggy will attempt to respond the best way it can determined by your input
and the input of others from previous sessions.
TEACHING:
---------
Ok, in order to teach, we need to know how Miggy learns. Imagine for a
moment your own children. If they are unattentive or the subject matter
just doesn't hold their interest, they'll simply refuse to learn - note
that this is almost a fully automatic process with the human psyche, and
most animals too. That aside, and remembering Miggy will always be fully
attentive, the teaching process rests ENTIRELY on yourselves. (oooh!)
Anyhoo.. You have to carefully consider what Miggy learns, and how to spell
it out. Miggy uses 2 files for any intelligent decision: The Dictionary
and the Response files. The Dictionary file is continually updated whether
teaching or not. Any word you typed in a sentence not found in the
dictionary will be automatically added to it. That reminds me..
Spelling people, SPELLING! Argh! I can't begin to describe how atrocious
much of the spelling is that I've seen in documentation! I'm sure there's
a trend circulating amongst you lot. For example, many words have been
butchered simply by replacing "e" and "i" with "a":
"paramater" should be "parameter"
"infinate" "" "infinite"
"verticle" "" "vertical"
Spelling mistakes generated by persons not using their native language
however, are always excusable. In any case, the ability for another
person to use Miggy successfully is highly unlikely when many of the words
in the Dictionary entered by you are misspelled. If you have received a
version of Miggy from someone else then your best initial course of action
would be to spell-check the Dictionary :þ
Miggy's response capability is limited directly by what has been learned.
The Response file contains fields of pre-determined responses to word
combinations. The decision-making algorithm is as follows:
You type a sentence, then matches of words from your sentence found in a
field will derive a percentage as:
(# of words in your sentence + # of words from field) / 2 = X
% = # of matched words / X
The order of the words makes no difference.
The entire Response file is searched to determine the field with the
highest percentage match. A match of 100% immediately concludes the
search. This percentage is then used to respond as:
000.0 -> 033.3% = use response #1 from this field
033.4 -> 066.6% = "" #2 ""
066.7 -> 100.0% = "" #3 ""
Responses typed by you in Learn mode should be as generic as possible, that
is to say, hopefully devoid of subject matter. Example:
---------------------------------------------------------------------------
Learn mode activated - Type word/sentence to learn..
L>You are
Type 3 generic responses: 1st-Vague, 2nd-Semi coherent, 3rd-Understanding
1>I am what
2>I think so
3>Of course I am :)
---------------------------------------------------------------------------
Type "#l" to enter "Learn" mode.
You'll be presented with some text informing of the change in mode, and
the prompt and subsequent type will change colour.
From here, you have to carefully consider what to type. Single words are
OK although teaching Miggy the meaning to "It" could be difficult, as how
miggy uses it in a response computes from what the user typed to begin
with. The longer the sentences you make Miggy learn, the greater the
combination of differing words and the less chance that someone else would
type a sentence of sufficient match for an appropriate response.
Confused yet?
If you teach Miggy "You are" and you enter later exactly "Are you", the
match will still be 100%. If Miggy already knows "You are" and you enter
something like "Are you intelligent?", the percentage obtained will be over
66.6%, and therefore would use the response "OF COURSE I AM :)". If you
then ask Miggy "Are you intelligent enough to understand?", then the
response percentage would be around 50.0% and would use response #2. The
exact same responses will be obtained by swapping "Are you" with "You are"
in the above examples.
You can also help yourself teaching by simply beginning, carrying out, and
then ending an entire conversation while teaching the whole time, chained
together by some of the responses you type while in "Learn" mode.
Naturally, generic conversation would work best as you could imagine but
you MUST type 3 responses! There's NO abort function. When in learn mode
you should check your spelling and grammar before pressing [enter]. Use
smileys ":)" for responses. It all adds to the fun.
If you're unsure as to whether Miggy already knows what you want him to
learn, then from outside "Learn" mode, type what you want to teach. If the
match is less than 100% you know that he doesn't already know it. If the
match is fairly high but still not 100% - say 80, then teach it anyway as
it all adds up to more useful data.
WARNING:
--------
Do NOT edit the Dictionary or Response files unless you KNOW what you're
doing! Editing the Dictionary in a random manner may render the Response
file and Miggy completely useless, and you'll have to start the Dictionary
and Response files all over again!
Dictionary file format:
WORDINUPPERCASE[return]
NEXTWORD[return]
. . .[return]
. . .[return]
LASTWORD[return]
Response file format: (in HEX)
Numberofwords-1 + wordnumber + wordnumber
01 0024 0046
Response field = Sentence learned -> 0100240046 +
Response #1 -> 0300180006001A000E +
Response #2 -> 00002D +
Response #3 -> 0200440003000A
TO CONVERT TO ANOTHER LANGUAGE: (probably the easiest way!)
-------------------------------
Delete the Responses file.
Edit the Dictionary to contain a MINIMUM of one word. Terminating each
word with a linefeed (0x0a).
Edit the MiggyText file to your language, terminating each of the 10 lines
with a linefeed.
Start Miggy and it'll go straight into "Learn" mode. Teach Miggy as much
as possible.
Create a new copy of this doc file in your own language, and take credit
for it at the top of this file with the date. :)
Archive all the original files together with your native language files and
call the archive:
Miggy1(First 3 letters of language + Response file KB).lha.
Example: English version and Response file at 52,000 bytes
Miggy1ENG052.lha
Miggy1ENG052.readme
Send it to Aminet and all your friends, and I'll thank you very much! :)
WHAT I HOPE WILL HAPPEN: 8)
------------------------
People download Miggy.
Enjoy and teach it as much as possible.
Enter their name at the top of this doc file with the date.
Archive it all back together and name the archive as above.
Send to Aminet and all their friends.
And I'll thank them very much too! :)
WHAT MIGHT HAPPEN:
------------------
Miggy's fame grows.
Spies worldwide use it to send secret messages to their governments.
Urban Mueller arrested by Interpol.
Miggy dies a lonely death in Cyberspace..
FUTURE:
-------
Maybe an abort function in the "Learn" mode.
Fully automatic learning - IF I can figure a way :)
A command to make it sleep and go away for a random period of time then
pop back up demanding solace of some kind. :þ
Get it to execute CLI commands. :)
Include a spell-checker because my girlfriend REALLY needs one! [sigh]